package dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

import bean.Business;
import bean.Food;
import business.BusinessWindow;
import util.DBUtil;

public class FoodDao {
	public boolean insertFood(Food food){
		boolean flag=false;
		String sql="insert into food values(?,?,?,?,?)";
		Connection conn=DBUtil.getConnection();
		try {
			PreparedStatement ps=conn.prepareStatement(sql);
			ps.setInt(1, food.getFood_id());
			ps.setString(2, food.getFood_name());
			ps.setString(3, food.getFood_info());
			ps.setDouble(4, food.getFood_price());
			ps.setInt(5, BusinessWindow.business_id);
			int count=ps.executeUpdate();
			if(count>0){
				flag=true;
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return flag;
	}
}
